package com.javaee.service.admin.impl;

import com.javaee.entity.Admin;
import com.javaee.mapper.admin.AdminMapper;
import com.javaee.service.admin.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminMapper adminMapper;
    @Override
    public String login(Admin admin) {
        Admin foundAdmin = adminMapper.findByUsername(admin.getUsername());
        if (foundAdmin == null) {
            return "用户名错误";
        }
        if (!foundAdmin.getPassword().equals(admin.getPassword())) {
            return "密码错误";
        }
        return "登录成功";
    }
    @Override
    public void updatePwd(String username, String password) {
       adminMapper.updatePwd(username,password);
    }
}
